/*
#include <stdio.h>
int main(int argc, char* argv[]){
    int i = 0;
    int arr[3] = {0};
    for(;i<=3; i++){
        if(i == 3) {
            printf("%p",&i);
            printf("%p\n",&arr[i]);
        }
        arr[i] = 2;
        printf("hello world\n");
    }
    return 0;
}
*/
#include<iostream>
using namespace std;
#include<string.h>
//#include <c++/4.8.3/cstring>

class Employee
{public:
    Employee(char * , char * );
    virtual ~ Employee(){}
    void setName();
    char * getNmae();
    void setID();
    char * getID();
    virtual float pay()=0;
    virtual void print()=0;
protected:
    char name[20];
    char id[20];
};
Employee::Employee(char * name, char * id)
{	strcpy(this->name, name);
    strcpy(this->id, id);
}
void Employee:: setName()
{
    cout<<"Please enter employrr's name: "<<endl;
    cin>>name;
}
char * Employee:: getNmae(){ return name; }
void Employee::setID()
{
    cout<<"Please enter employee's ID: "<<endl;
    cin>>id;
}
char * Employee::getID(){ return id; }

class Manager : public Employee
{public:
Manager(char * name, char * id, float salary):Employee(name, id)
{ this->salary=salary; }
~Manager(){}
float pay(){ return salary; }
void print()
{ cout<<endl<<"name:"<<name<<" ID: "<<id<<" pay: "<<pay()<<endl; }
private:
float salary;
};
class Technician: public Employee
{public:
    Technician(char * name, char * id, int hours, float wage): Employee(name, id)
    {	this->hours=hours; this->wage=wage;	}
    ~Technician(){}
    float pay(){return hours * wage;}
    void print()
    { cout<<endl<<"name: "<<name<<" ID: "<<id<<" pay: "<<pay()<<endl; }
private:
    int hours;
    float wage;
};
int main()
{	Employee * p;
    Manager manager("Zhang", "101", 9000);
    p=&manager;
    p->print();
    Technician technician("Zhang", "112", 8 * 29, 30);
    p=&technician;
    p->print();
    return 0;
}
